package com.cheejee.goodscenter.module.entity;

import java.math.BigDecimal;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.cheejee.goodscenter.validated.InsertGroup;
import com.cheejee.goodscenter.validated.UpdateGroup;

public class Sku {

	@NotNull(message = "SKU ID不能为空", groups = UpdateGroup.class)
	private Long id;

	@NotNull(message = "商品ID不能为空", groups = { UpdateGroup.class, InsertGroup.class })
	private Long goodsId;

	/**
	 * 规格id的组合，多个id使用，分隔
	 */
	@NotBlank(message = "规格组合不能为空", groups = { UpdateGroup.class, InsertGroup.class })
	private String goodsSpecificIdGroup;

	@NotNull(message = "SKU价格不能为空", groups = { UpdateGroup.class, InsertGroup.class })
	private BigDecimal price;

	@NotNull(message = "SKU库存不能为空", groups = { UpdateGroup.class, InsertGroup.class })
	private Integer stock;

	private String pic;

	private Integer sale;

	@NotNull(message = "SKU上架状态不能为空", groups = { UpdateGroup.class, InsertGroup.class })
	private Boolean isOn;

	private String webDetail;

	private String mobileDetail;

	public Sku() {
		super();
	}

	public Sku(Long id, Long goodsId, String goodsSpecificIdGroup, BigDecimal price, Integer stock, String pic, Integer sale, Boolean isOn, String webDetail, String mobileDetail) {
		super();
		this.id = id;
		this.goodsId = goodsId;
		this.goodsSpecificIdGroup = goodsSpecificIdGroup;
		this.price = price;
		this.stock = stock;
		this.pic = pic;
		this.sale = sale;
		this.isOn = isOn;
		this.webDetail = webDetail;
		this.mobileDetail = mobileDetail;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(Long goodsId) {
		this.goodsId = goodsId;
	}

	public String getGoodsSpecificIdGroup() {
		return goodsSpecificIdGroup;
	}

	public void setGoodsSpecificIdGroup(String goodsSpecificIdGroup) {
		this.goodsSpecificIdGroup = goodsSpecificIdGroup == null ? null : goodsSpecificIdGroup.trim();
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public Integer getStock() {
		return stock;
	}

	public void setStock(Integer stock) {
		this.stock = stock;
	}

	public String getPic() {
		return pic;
	}

	public void setPic(String pic) {
		this.pic = pic == null ? null : pic.trim();
	}

	public Integer getSale() {
		return sale;
	}

	public void setSale(Integer sale) {
		this.sale = sale;
	}

	public Boolean getIsOn() {
		return isOn;
	}

	public void setIsOn(Boolean isOn) {
		this.isOn = isOn;
	}

	public String getWebDetail() {
		return webDetail;
	}

	public void setWebDetail(String webDetail) {
		this.webDetail = webDetail == null ? null : webDetail.trim();
	}

	public String getMobileDetail() {
		return mobileDetail;
	}

	public void setMobileDetail(String mobileDetail) {
		this.mobileDetail = mobileDetail == null ? null : mobileDetail.trim();
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(id);
		sb.append(", goodsId=").append(goodsId);
		sb.append(", goodsSpecificIdGroup=").append(goodsSpecificIdGroup);
		sb.append(", price=").append(price);
		sb.append(", stock=").append(stock);
		sb.append(", pic=").append(pic);
		sb.append(", sale=").append(sale);
		sb.append(", isOn=").append(isOn);
		sb.append(", webDetail=").append(webDetail);
		sb.append(", mobileDetail=").append(mobileDetail);
		sb.append("]");
		return sb.toString();
	}
}